﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {   //SortedList  有序列表     HashList   无序列表
            SortedList SL = new SortedList ();
            SL.Add(3,"你也走了很远的路吧");
            SL.Add(1,"原你不在颠沛流离");
            SL.Add(2,"你要相信没有到不了的明天");
            foreach (DictionaryEntry item in SL)
            {
                Console.WriteLine("{0} {1}",item.Key ,item.Value );
            }
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            SortedList SL1 = new SortedList ();
            SL1.Add("3","你也走了很远的路吧");
            SL1.Add("1","原你不在颠沛流离");
            SL1.Add("2","你要相信没有到不了的明天");
            foreach (DictionaryEntry item in SL1)
            {
                Console.WriteLine("{0} {1}",item.Key ,item.Value );
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            SortedList<int, string> list = new SortedList<int, string>(); 
            list.Add(1, "你也走了很远的路吧");
            list.Add(2, "原你不在颠沛流离");
            list.Add(3, "你要相信没有到不了的明天");
            foreach (DictionaryEntry item in SL1)
            {
                Console.WriteLine("{0} {1}", item.Key, item.Value);
            }
        }
    }


}
